#include "progress.h"

#define STYLE '='
#define SIZE 51

void process()
{
  char str[SIZE];
  char rotat[] = "/-|\\";

  memset(str, '\0', SIZE);
  int i = 0;

  while(i <= 100)
  {

    printf("[%-50s][%d%%][%c]\r", str, i, rotat[i%4]);//\r将光标回到当前行最开始的位置
    
    int judge = i / 2;
    if(i % 2 == 0)
     str[judge] = STYLE;

    if(judge != 49)
      str[judge + 1] = '>';

    i++;
    
    fflush(stdout);//刷新缓冲池，将字符输出到屏幕
    usleep(100000);

  }
  printf("\n");
  
}
